/*
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-09-04 16:43:34
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-09-18 11:41:43
 * @FilePath: \linePatrol\vue-element-plus-admin\src\api\securcheck\CompanyLedger.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import service from '@/axios/http'
import { TableIResponse } from '@/utils/Api'
import { ProducerLedger } from './type'
export class SecurCheckProducerLedgerApi {
  //查询厂商台账列表
  async GetProducerLedger(params: any): Promise<TableIResponse<ProducerLedger[]>> {
    const result = (await service.get('/api/securcheck/producerLedger/list', {
      params
    })) as unknown as any
    return result
  }
  //查询所有厂商台账列表
  async GetAllProducerLedger(): Promise<ProducerLedger[]> {
    const result = (await service.get('/api/securcheck/producerLedger/listAll')) as unknown as any
    const { code, data } = result
    if (code == 200) {
      return data
    } else {
      return []
    }
  }
  //删除厂商台账列表
  async DeletProducerLedger(uuids: string | undefined): Promise<boolean> {
    const result = (await service.delete(
      `/api/securcheck/producerLedger/${uuids}`
    )) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //新增厂商台账列表
  async AddProducerLedger(data: ProducerLedger): Promise<boolean> {
    const result = (await service.post('/api/securcheck/producerLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //修改厂商台账列表
  async EditProducerLedger(data: ProducerLedger): Promise<boolean> {
    const result = (await service.put('/api/securcheck/producerLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //查询厂商台账列表
  async GetProducerLedgerById(uuid: string | undefined): Promise<ProducerLedger> {
    const result = (await service.get(`/api/securcheck/producerLedger/${uuid}`)) as unknown as any
    const { code, data } = result
    if (code == 200) {
      return data
    } else {
      return {}
    }
  }
}
export default new SecurCheckProducerLedgerApi()
